# -*- coding: utf-8 -*-
# @Time    : 2019/10/15 19:51
# @Author  : LiHaowen
# @Email   : lihaowen2017@163.com
# @File    : try_test.py

# try except/finally
def abc():
    try:
        print("code 1")
        raise KeyError
        return 1
    except KeyError as e:
        print("key error")
        return 2
    else:
        print("other error")
        return 3

    finally:
        #  一般用于资源释放
        print("finally")
        # return 4



if __name__ == '__main__':
    result = abc()
    print(result)